# 498. 成绩分析
# https://www.lanqiao.cn/problems/1498/learning/?page=1&first_category_id=1&second_category_id=3
# Date: 2025/2/16
from datetime import *


def get_dates(start_date):
    start = date(int(start_date[:4]), int(start_date[4:6]), int(start_date[6:]))
    end = date(9999, 12, 31)
    res1, res2 = None, None
    while start <= end:
        start += timedelta(1)
        formatted_date = str(start).replace('-', '')
        if formatted_date == formatted_date[::-1]:  # 判断是否是回文日期
            if not res1:
                res1 = formatted_date
            if (formatted_date[0] == formatted_date[-1] == formatted_date[2] == formatted_date[5]) and (
                    formatted_date[1] == formatted_date[3] == formatted_date[4] == formatted_date[-2]):
                res2 = formatted_date
                return res1, res2


if __name__ == '__main__':
    res1, res2 = get_dates("20200202")
    print(res1)
    print(res2)
